<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/10/22
 * Time: 16:28
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class Share extends Admin_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('Share_model');
    }
    /*
     * discription:分享列表首页
     * author:胡亮
     * date:2020/10/23
     * */
    public function index(){
        $data=$this->data;
        $this->load->view('admin/Share/index',$data);
    }
    /*
     * discription:获取分享列表
     * author:胡亮
     * date:2020/10/22
     * **/
    public function GetShareList() {
        $limit = $this->input->get('limit')?$this->input->get('limit'):10;
        $page = $this->input->get('page')?$this->input->get('page'):1;
        $offset = $limit*($page-1);
        $ShareList = $this->Share_model->GetShareList($offset,$limit);
        $result['code'] = 0;
        $result['msg'] = '';
        $result['data'] = $ShareList;
        $result['count'] = $this->Share_model->GetShareCount();
        echo json_encode($result);
    }
    /*
     * discription:详情列表
     * author:胡亮
     * date：2020/10/23
     * **/
    public function detail(){
        $id = $this->input->get('id');
        $ShareInfo = $this->Share_model->GetShareOne($id);
        $data['data'] = $ShareInfo;
//        if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
//            $data['code'] = 0;
//            $data['msg'] = '';
//        }else{
            $this->load->view('admin/Share/detail',$data);
//        }
    }
}